import request from '@/utils/request'

enum API {
  GroupList = '/agent/view/index',
  RateCode = '/agent/view/getRateCode',
  EditRateCode = '/agent/view/editRateCode',
  AddUser = '/agent/newAgent/add',
  GetCountInfo = '/agent/teamBill/index'
}

export function GetCountInfoApi(params: any) {
  return request({
    url: API.GetCountInfo,
    method: 'post',
    data: params
  })
}

export function AddUserApi(data: {
  username: string
  password: string
  nickname: string
  contact?: string
}) {
  return request({
    url: API.AddUser,
    method: 'post',
    data
  })
}

export function GroupListApi() {
  return request({
    url: API.GroupList,
    method: 'post'
  })
}

export function getRateCodeApi(id: string) {
  return request({
    url: API.RateCode,
    method: 'post',
    data: {
      id
    }
  })
}

export function EditRateCodeApi(data: any) {
  return request({
    url: API.EditRateCode,
    method: 'post',
    data
  })
}
